from os.path import exists, dirname, join
import _locale
_locale._getdefaultlocale = lambda *args: ['zh_CN', 'utf8']
from qtpy import uic


def compile_ui_dir(src, out, recurse=False, **compileUi_args):
    if not exists(src) or not exists(out):
        return

    def _map(uidir, mname):
        return out, ''.join(['ui_', mname])

    uic.compileUiDir(src, recurse, _map, **compileUi_args)


base_dir = dirname(__file__)
compile_ui_dir(join(base_dir, 'ui'), base_dir)
